 
package com.xbongbong.paas.domain.dao;

import com.xbongbong.paas.domain.entity.PaasCommentEntity;
import com.xbongbong.paas.domain.entity.ext.PaasCommentEntityExt;
import com.xbongbong.paas.pojo.dto.ReplyCountDTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


/**
* @author autoGen
* @time 2018-08-13 10:43:26
*/
@Repository
@Mapper
public interface PaasCommentDao {

	 
	Integer insert(PaasCommentEntity paasComment);
	Integer update(PaasCommentEntity paasComment);
	
	Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);
	PaasCommentEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

	Integer deleteByRefId(@Param("refId") Long refId, @Param("corpid") String corpid, @Param("appId") Long appId, @Param("type") Integer type);
	
	List<PaasCommentEntityExt>  findEntitys(@Param("param") Map<String, Object> param);
	Integer getEntitysCount(@Param("param") Map<String, Object> param);

	/**
	 * 批量插入评论
	 * @param list
	 */
	Integer insertBatch(@Param("list") List<PaasCommentEntityExt> list);

	/**
	 * 批量更新评论中某公司某用户的姓名和头像
	 */
	Integer dataConsistencyUpdateUser(@Param("corpid") String corpid, @Param("userId") String userId, @Param("userName") String userName, @Param("userAvatar") String userAvatar);
	/**
	 * 批量更新评论中某公司某被评论者的姓名
	 */
	Integer dataConsistencyUpdateRefUser(@Param("corpid") String corpid, @Param("userId") String userId, @Param("userName") String userName);

	/**
	 * 批量获取评论下的回复数量
	 * @param corpid 公司id
	 * @param type 参考BusinessCommentEnum.COMMENT_REPLY
	 * @param commentIdList 评论id列表
	 * @return
	 */
	List<ReplyCountDTO> batchGetReplyCount(@Param("corpid") String corpid, @Param("type") Integer type, @Param("commentIdList") List<Long> commentIdList);

	/**
	 * 删除指定评论下的所有的回复信息
	 * @param commentId 评论id
	 * @param corpid 公司id
	 * @param replyType 参考BusinessCommentEnum.COMMENT_REPLY
	 */
	void deleteCommentWithReply(@Param("commentId") Long commentId, @Param("corpid") String corpid, @Param("replyType") Integer replyType);
}